package com.ciaj.base.comm.utils;

import com.ciaj.base.comm.constant.DefaultConstant;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.InvalidSessionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author: Ciaj.
 * @Date: 2018/6/19 17:34
 * @Description:
 */
public class CommUtil {
    private static Logger logger = LoggerFactory.getLogger(CommUtil.class);

    public static Object getLoginUser() {
        try {
            return SecurityUtils.getSubject().getSession().getAttribute(DefaultConstant.LOGIN_USER);
        } catch (InvalidSessionException e) {
            logger.error("获取登录用户异常", e);
        }
        return null;
    }
}
